﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLZJFurnitureSCM.DAL;
using QLZJFurnitureSCM.Model;

namespace QLZJFurnitureSCM.BLL
{
    public class OrderProductService
    {
        private IBaseDAO<OrderProduct> baseDAO = new OrderProductDAO();

        public OrderProduct Insert(OrderProduct orderProduct)
        {
            return baseDAO.Create(orderProduct);
        }

        public bool InsertBatch(List<OrderProduct> lstOrderProduct)
        {
            foreach(OrderProduct orderProduct in lstOrderProduct)
            {
                baseDAO.Create(orderProduct);
                if (!(orderProduct.OrderProductId > 0))
                    return false;
            }
            return true;
        }

        public List<OrderProduct> FindAll()
        {
            return baseDAO.ReadAll();
        }
    }
}
